package com.hao.common;

import lombok.Data;

/**
 * API响应结果类
 */
@Data
public class ApiResponse {
    
    /**
     * 响应码
     */
    private int code;
    
    /**
     * 响应消息
     */
    private String message;
    
    public ApiResponse() {}
    
    public ApiResponse(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    /**
     * 成功响应
     */
    public static ApiResponse success() {
        return new ApiResponse(200, "数据接收成功");
    }
    
    /**
     * 失败响应
     */
    public static ApiResponse error(String message) {
        return new ApiResponse(400, message);
    }
    
    /**
     * 自定义响应
     */
    public static ApiResponse of(int code, String message) {
        return new ApiResponse(code, message);
    }
} 